package com.bit.ioc.controller;

import com.bit.ioc.config.UserConfig;
import com.bit.ioc.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

@Controller
public class HelloController {
    //进行依赖注入的使用；
    //1.属性注入；
//    @Autowired
//    private UserService userService;
    @Autowired
    private UserConfig userConfig;
    //2.构造方法的注入；
//    private UserService userService;
//    private UserConfig userConfig;
//    public HelloController(){
//    }
//    @Autowired
//    public HelloController(UserService userService,UserConfig userConfig){
//        this.userService=userService;
//        this.userConfig=userConfig;
//    }
    //3.set方法注入的使用；
//    private UserService userService;
//    private UserConfig userConfig;
//    @Autowired
//    public void setUserService(UserService userService) {
//        this.userService = userService;
//    }
//    @Autowired
//    public void setUserConfig(UserConfig userConfig) {
//        this.userConfig = userConfig;
//    }

    public void print(){
        System.out.println("hell Controller");
//        userService.print();
        userConfig.print();
    }
}
